package com.ruoyi.project.channel.vwPlatformUserStat.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.channel.vwPlatformUserStat.domain.VwPlatformUserStat;
import com.ruoyi.project.channel.vwPlatformUserStat.service.IVwPlatformUserStatService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * VIEW信息操作处理
 * 
 * @author CAIN
 * @date 2021-05-20
 */
@Controller
@RequestMapping("/channel/vwPlatformUserStat")
public class VwPlatformUserStatController extends BaseController
{
    private String prefix = "channel/vwPlatformUserStat";
	
	@Autowired
	private IVwPlatformUserStatService vwPlatformUserStatService;
	
	@RequiresPermissions("channel:vwPlatformUserStat:view")
	@GetMapping()
	public String vwPlatformUserStat()
	{
	    return prefix + "/vwPlatformUserStat";
	}
	
	/**
	 * 查询VIEW列表
	 */
	@RequiresPermissions("channel:vwPlatformUserStat:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(VwPlatformUserStat vwPlatformUserStat)
	{
		startPage();
        List<VwPlatformUserStat> list = vwPlatformUserStatService.selectVwPlatformUserStatList(vwPlatformUserStat);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出VIEW列表
	 */
	@RequiresPermissions("channel:vwPlatformUserStat:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(VwPlatformUserStat vwPlatformUserStat)
    {
    	List<VwPlatformUserStat> list = vwPlatformUserStatService.selectVwPlatformUserStatList(vwPlatformUserStat);
        ExcelUtil<VwPlatformUserStat> util = new ExcelUtil<VwPlatformUserStat>(VwPlatformUserStat.class);
        return util.exportExcel(list, "vwPlatformUserStat");
    }
	
	/**
	 * 新增VIEW
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存VIEW
	 */
	@RequiresPermissions("channel:vwPlatformUserStat:add")
	@Log(title = "VIEW", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(VwPlatformUserStat vwPlatformUserStat)
	{		
		return toAjax(vwPlatformUserStatService.insertVwPlatformUserStat(vwPlatformUserStat));
	}

	/**
	 * 修改VIEW
	 */
	@GetMapping("/edit/{userSum}")
	public String edit(@PathVariable("userSum") Long userSum, ModelMap mmap)
	{
		VwPlatformUserStat vwPlatformUserStat = vwPlatformUserStatService.selectVwPlatformUserStatById(userSum);
		mmap.put("vwPlatformUserStat", vwPlatformUserStat);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存VIEW
	 */
	@RequiresPermissions("channel:vwPlatformUserStat:edit")
	@Log(title = "VIEW", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(VwPlatformUserStat vwPlatformUserStat)
	{		
		return toAjax(vwPlatformUserStatService.updateVwPlatformUserStat(vwPlatformUserStat));
	}
	
	/**
	 * 删除VIEW
	 */
	@RequiresPermissions("channel:vwPlatformUserStat:remove")
	@Log(title = "VIEW", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(vwPlatformUserStatService.deleteVwPlatformUserStatByIds(ids));
	}
	
}
